package com.hele.sts.pub;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2017/10/20 0020.
 */
public class R extends HashMap<String, Object> {

    private static final long serialVersionUID = 1L;

    public R() {
        put("resultCode", "00");
        put("resultInfo", "");
    }

    public static R error() {
        return error("99", "系统繁忙，请稍后再试");
    }

    public static R error(String msg) {
        return error("99", msg);
    }

    public static R error(String code, String msg) {
        R r = new R();
        r.put("resultCode", code);
        r.put("resultInfo", msg);
        return r;
    }

    public static R ok(String msg) {
        R r = new R();
        r.put("resultInfo", msg);
        return r;
    }

    public static R ok(Map<String, Object> map) {
        R r = new R();
        r.putAll(map);
        return r;
    }

    public static R ok() {
        return new R();
    }

    @Override
    public R put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}